﻿<?php
include("config/connect.php");
include("public/common.php");


function GetLastKey( $url, $key )
{
	$key .= "=";
	$nStart = stripos( $url, $key );
	if( $nStart !== false )
	{
		$nStart += strlen( $key );
		return htmlspecialchars( substr( $url, $nStart ), ENT_QUOTES );
	}
	return "";
}

$p = base64_decode( CheckUrlParamNoDie( "p" ) );
$p = EnCode( $p, "_goshopping_" );
$p = "&" . $p;

$title = GetLastKey($p, "title");
$tb_id = GetKey($p, "tb_id");
$item_id = GetKey($p, "item_id");
$price = floatval(GetKey($p, "price"));
$percent = floatval(GetKey($p, "percent"));
$ip = gethostbyname($_SERVER["REMOTE_ADDR"]);

$sql = "insert into other_trade(tb_id, title, item_id, ip, percent, price) values('$tb_id', '$title', '$item_id', '$ip', $percent, $price )";

$result = mysql_query( $sql );
if( $result )
{
	ReturnTrue();
}
else 
{
	ReturnFalse("添加失败。");
}
?>